<?php

namespace Aspic;

class Reflection {

	protected $classPath;
	
	/**
	 * @var \ReflectionClass
	 */
	protected $reflection;

	/**
	 * 
	 * @param mixed $class Class name or class object
	 */
	public function __construct($class) {
		if (is_object($class)) {
			$classPath = get_class($class);
		}
		elseif(!class_exists($class)) {
			throw new Exception('Class "'.$class.'" does not exist');
		}
		
		$this->reflection = new \ReflectionClass($classPath);
		$this->classPath = $classPath;
	}
	
	public function getMethodParamsNames($methodName) {
		$method = $this->reflection->getMethod($methodName);
		
		$parameters = $method->getParameters();
		
		$arrNames = array();
		
		foreach ($parameters as $p) {
			/* @var $p \ReflectionParameter */
			$arrNames[] = $p->getName();
		}
		
		return $arrNames;
	}

}